package com.baomidou.springwind.test;

/**
 * Created by Administrator on 2016/12/19.
 */
public class Dice extends Tosser {
    private int ONE = 0;
    private int TWO = 0;
    private int THREE = 0;
    private int FOUR = 0;
    private int FIVE = 0;
    private int SIX = 0;

    public Dice( int turn) {
        super(new Seeder(6), turn);
    }

    @Override
    public void showResults() {
        System.out.println("Play turns:" + turn);
        System.out.println("Get ONE:" + ONE + ","
                + (float) ONE / (float) turn * 100 + "%");
        System.out.println("Get TWO:" + TWO + ","
                + (float) TWO / (float) turn * 100 + "%");
        System.out.println("Get THREE:" + THREE + ","
                + (float) THREE / (float) turn * 100 + "%");
        System.out.println("Get FOUR:" + FOUR + ","
                + (float) FOUR / (float) turn * 100 + "%");
        System.out.println("Get FIVE:" + FIVE + ","
                + (float) FIVE / (float) turn * 100 + "%");
        System.out.println("Get SIX:" + SIX + ","
                + (float) SIX / (float) turn * 100 + "%");
    }

    @Override
    public void runToss() {
        for (int i = 0; i < turn; i++) {
            int j = curseed.getValue();
            switch (j) {
                case 0:
                    ONE++;
                    break;
                case 1:
                    TWO++;
                    break;
                case 2:
                    THREE++;
                    break;
                case 3:
                    FOUR++;
                    break;
                case 4:
                    FIVE++;
                    break;
                case 5:
                    SIX++;
                    break;
            }
        }
    }

    public static void main(String[] args) {
        long starTime = System.currentTimeMillis();
        Dice di=new Dice(200000);
        di.runToss();
        di.showResults();
        long endTime = System.currentTimeMillis();
        System.out.println((endTime - starTime));
    }
}
